import { IFeidaoAiNodejsComponent } from '@feidao/web/interfaces';
import nodejs from '@feidao/web/atom/nodejs/msg-b/nodejs';
import render from '@feidao/web/atom/nodejs/render/render';

import P01 from './P01';

export default async function nba001(fd: IFeidaoAiNodejsComponent, ...args: any[]) {
	const res = await nodejs(fd.data.spaceid, "dept_find", { filter: {}, page_size: 0 });
	if (res.length == 0) {
	} else {
		const cdata = res.map((d: any) => {
			return { id: d.deptid, name: d.deptname, p_id: d.parent_dept_code };
		});
		render(fd.data.node, JSON.stringify(cdata), P01, 'P01');
	}
}
